<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"
%><%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"
%><%@ taglib prefix="security" uri="http://www.springframework.org/security/tags"
%><%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"
%><%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"
%>
<head>
    <title><fmt:message key="structure" /></title>
</head>
<body>
    <h1><fmt:message key="structure" /></h1>
    <c:url var="createUrl" value="/domain/structure/create"/>
    <form:form action="${createUrl}" id="structureForm" modelAttribute="structureForm" >
        <form:errors cssClass="error"/>
        <table>
            <form:hidden path="structure.inode"/>
            <tbody>
                <tr>
                    <th><fmt:message key="structure_structuretype" /> *</th>
                    <td>
						<form:select path="structure.structureType" items="${structureTypeList}" itemLabel="displayName" itemValue="x" />
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "structure.structureType",
                                widgetType : "dijit.form.FilteringSelect",
                                widgetAttrs : {
                                    required : true
                                }
                            }));
                        </script>

                        <form:errors cssClass="error" path="structure.structureType"/>
                    </td>
                    <th><fmt:message key="structure_enableReview" /></th>
                    <td>
                        <form:checkbox path="enableReview" id="enableReview" />
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "enableReview",
                                widgetType : "dijit.form.CheckBox",
                                widgetAttrs : {
                                    checked: ${structureForm.enableReview != null ? structureForm.enableReview : false}
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="enableReview"/>
                    </td>

                </tr>

                <tr>
                    <th><fmt:message key="structure_name" /> *</th>
                    <td>
                        <form:input path="structure.name"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "structure.name",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : true
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="structure.name"/>
                    </td>
                    <th><fmt:message key="structure_reviewInterval" /></th>
                    <td>
                        <form:select path="reviewIntervalNum">
							<form:options items="${reviewIntervalNums}" />
						</form:select>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "reviewIntervalNum",
                                widgetType : "dijit.form.ComboBox",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="reviewIntervalNum"/>
                        <form:select path="reviewIntervalSelect" >
							<form:options items="${reviewIntervalSelects}" itemValue="value" itemLabel="displayName" />
						</form:select>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "reviewIntervalSelect",
                                widgetType : "dijit.form.FilteringSelect",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="reviewIntervalSelect"/>
                    </td>

                </tr>
                <tr>
                    <th><fmt:message key="structure_velocityVarName" /> *</th>
                    <td>
                        <form:input path="structure.velocityVarName"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "structure.velocityVarName",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : true
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="structure.name"/>
                    </td>
                    <th><fmt:message key="structure_reviewerRole" /></th>
                    <td>
                        <form:select path="structure.reviewerRole" >
							<form:options items="${reviewIntervalRoles}" itemValue="roleName" itemLabel="roleName" />
						</form:select>

                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "structure.reviewerRole",
                                widgetType : "dijit.form.ComboBox",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="structure.reviewerRole"/>
                    </td>

                </tr>
                <tr>
                    <th><fmt:message key="structure_description" /></th>
                    <td>
                        <form:input path="structure.description"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "structure.description",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="structure.description"/>
                    </td>
                    <th><fmt:message key="structure_pageDetail" /></th>
                    <td>
                        <form:input path="structure.pageDetail"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "structure.pageDetail",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false
                                    ,regExp : "[-+]?[0-9]+(\.[0-9]+)?"
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="structure.pageDetail"/>
						<a href="#">Select Page</a>
                    </td>

                </tr>
                <tr>
					<th>&nbsp;</th>
					<td>&nbsp;</td>
                    <th><fmt:message key="structure_urlMapPattern" /></th>
                    <td>
                        <form:input path="structure.urlMapPattern"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "structure.urlMapPattern",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="structure.urlMapPattern"/>
                    </td>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="4">
                        <div class="buttons">
                            <button id="saveButton" class="ok" type="submit"><fmt:message key="label.form.submit"/></button>
                            <script type="text/javascript">
                                Spring.addDecoration(new Spring.ValidateAllDecoration({
                                    elementId:'saveButton',
                                    event:'onclick'
                                }));
                            </script>
                        </div>
                    </td>
                </tr>
            </tfoot>
        </table>
    </form:form>
</body>
